<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2023/4/14
 * Time: 14:19
 */

namespace App\Rep;


use App\Models\File;

class FileRep
{
    /**
     * Notes: 保存文件信息到DB
     * @param $user_id
     * @param $file_name
     * @param $file_md5
     * @param $file_url
     * @param $file_size
     * @param $file_mime
     * @param $upload_ip
     * @return File
     */
    public function saveFile($user_id,$file_name,$file_md5,$file_url,$file_size,$file_mime,$upload_ip){
        $file = new File();
        $file->user_id = $user_id;
        $file->file_name = $file_name;
        $file->file_md5 = $file_md5;
        $file->file_url = $file_url;
        $file->file_size = $file_size;
        $file->file_mime = $file_mime;
        $file->upload_ip = $upload_ip;
        $file->save();
        return $file;
    }
}